package com.bjpowernode.ba03;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

//省略value
@Component("myStudent")
public class Student {

    /**
     * @Value：简单类型的属性赋值
     *
     */

    @Value("张飞")
    private String name;
    @Value("29")
    private Integer age;

    /**
     * 引用类型
     */
    @Autowired
    private School school;

    public Student() {
        System.out.println("==Student无参数构造方法===");
    }

//    public void setName(String name) {
//        this.name = name;
//    }
//
//    public void setAge(Integer age) {
//        this.age = age;
//    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", school=" + school +
                '}';
    }
}
